<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>积分兑换活动页面</title>
    <link rel="stylesheet" href="">
    <link rel="stylesheet" href="/main/css/style.css">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
</head>
<body>
<!--fixed remove-->
<section class="fixed" style="z-index:999;width: 100%;height: 100%;background-color: #000;position: fixed;left: 0;top: 0;"></section>
<section class="activity_page">
    <div class="header">

        <div class="wrap_avatar">
            <span class="avatar"><img src="{%$user.headimg|default:'/main/img/avator.jpg'%}"></span><em>{%$user.username|default:''%}</em>
        </div>
        <p class="total_point">兑换积分:<em class="font34">{%$user.intergtal|default:0%}</em></p>
    </div>
    <!--切换部分-->
    <div class="mainTab">
        <div class="main-tab-nav">
            <ul class="clearfix">
                <li class="current">亲子活动</li>
                <li><a href="/clothing">童装试用</a></li>
            </ul>
        </div>
        <div class="main-tab-con">

            <!--亲子活动-->
        <div class="cnt family_day">
          <div class="title"></div>
            <div id="body"></div>
        </div>

        </div>
    </div>
</section>
</body>
<script src="/main/js/jquery-1.12.3.min.js"></script>
<script src="/main/js/common.js"></script>
<script src="/main/js/jquery.touchSwipe.js"></script>
<script>
 var page=1;


$(function () {
    checkweichatevent();
    Init();
    $("body").swipe({
            //Generic swipe handler for all directions
            swipe: function (event, direction, distance, duration, fingerCount, fingerData) {

                if (direction == 'up') {
                    page++;
                    Init()
                }
            },
            allowPageScroll: 'vertical',
        }
    );

})




function Init() {
    $.ajax({
        type: "POST",
        url: "/api/getactivity.json",
        data: {page: page},
        success: function (e) {
            $.each(e.data, function (k, v) {
                var div='';
                if (v.media == '') {
                    div = div + '<div class="activity_item activity_item_1">';
                } else {
                    div = div + '<div class="activity_item activity_item_1" style="background: url(/upload/' + v.media + ') 0 0 no-repeat;">';
                }

                div = div + '<div class="sub_title">' + v.activityname + '</div>';
                div = div + '<dl>';
                div = div + '<dd>适合年龄:' + v.minage + '-' + v.maxage + '</dd>';
                div = div + '<dd>活动时间:' + v.starttime + '-' + v.endtime + '</dd>';
                div = div + '<dd>招募家庭:' + v.maxnum + '组</dd>';
                div = div + '<dd>已招募:' + v.joinnum + '组</dd>';
                div = div + '</dl>';
                div = div + '<a class="bottom_btn" href="/activity_detail/' + v.id + '">点击详情<br/>' + v.maxintegral + '积分开启</a>';
                div = div + '</div>';
                $("#body").append(div);

            });
        }
    });
}
</script>
</html>